package rpd.mapper;

import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import rpd.model.TbCompany;
import rpd.model.TbCompanyExample;
import rpd.model.TbCompanyKey;

public interface TbCompanyMapper {
    long countByExample(TbCompanyExample example);

    int deleteByExample(TbCompanyExample example);

    @Delete({
        "delete from tb_company",
        "where company_id = #{companyId,jdbcType=CHAR}"
    })
    int deleteByPrimaryKey(TbCompanyKey key);

    @Insert({
        "insert into tb_company (company_id, company_name, ",
        "company_logo_path, address, ",
        "telephone, info, HRs, ",
        "recruitments, province, ",
        "city, area)",
        "values (#{companyId,jdbcType=CHAR}, #{companyName,jdbcType=CHAR}, ",
        "#{companyLogoPath,jdbcType=CHAR}, #{address,jdbcType=CHAR}, ",
        "#{telephone,jdbcType=CHAR}, #{info,jdbcType=CHAR}, #{hrs,jdbcType=CHAR}, ",
        "#{recruitments,jdbcType=CHAR}, #{province,jdbcType=CHAR}, ",
        "#{city,jdbcType=CHAR}, #{area,jdbcType=CHAR})"
    })
    int insert(TbCompany record);

    int insertSelective(TbCompany record);

    List<TbCompany> selectByExample(TbCompanyExample example);

    @Select({
        "select",
        "company_id, company_name, company_logo_path, address, telephone, info, HRs, ",
        "recruitments, province, city, area",
        "from tb_company",
        "where company_id = #{companyId,jdbcType=CHAR}"
    })
    @ResultMap("rpd.mapper.TbCompanyMapper.BaseResultMap")
    TbCompany selectByPrimaryKey(TbCompanyKey key);

    int updateByExampleSelective(@Param("record") TbCompany record, @Param("example") TbCompanyExample example);

    int updateByExample(@Param("record") TbCompany record, @Param("example") TbCompanyExample example);

    int updateByPrimaryKeySelective(TbCompany record);

    @Update({
        "update tb_company",
        "set company_name = #{companyName,jdbcType=CHAR},",
          "company_logo_path = #{companyLogoPath,jdbcType=CHAR},",
          "address = #{address,jdbcType=CHAR},",
          "telephone = #{telephone,jdbcType=CHAR},",
          "info = #{info,jdbcType=CHAR},",
          "HRs = #{hrs,jdbcType=CHAR},",
          "recruitments = #{recruitments,jdbcType=CHAR},",
          "province = #{province,jdbcType=CHAR},",
          "city = #{city,jdbcType=CHAR},",
          "area = #{area,jdbcType=CHAR}",
        "where company_id = #{companyId,jdbcType=CHAR}"
    })
    int updateByPrimaryKey(TbCompany record);
}